"use strict";TABS.landing={},TABS.landing.initialize=function(e){"landing"!=GUI.active_tab&&(GUI.active_tab="landing",googleAnalytics.sendAppView("Landing")),$("#tabContent").load("./tabs/landing.html",function(){translateAll();var t=getMessage("currentVersion");getMessage("latestVersion");$(".td1").append(t+chrome.runtime.getManifest().version+"<br/>"),""===CONFIG.latest_version.value?console.log("XML file for latest app version was not downloaded."):$(".td1").append(getMessage("latestVersion")+CONFIG.latest_version.value+"<br/>"),document.getElementById("updateSection").style.display="block";$(".updateValidate");$("#updateButton").click(function(){window.open("https://docs.rcbenchmark.com/en/dynamometer/software/dynamometer-software-download.html","_blank")}),$("div.changelog.configurator .wrapper").load("https://cdn-docs.rcbenchmark.com/software-release/rcb-thrust-stands-01/changelog.html"),$(".tab-landing #changeLog").on("click",function(){$("#showDialog").load("https://cdn-docs.rcbenchmark.com/software-release/rcb-thrust-stands-01/changelog.html",function(e,t,n){"error"==t?alert(getMessage("serverNA")):$("#showDialog").dialog({show:{effect:"blind",duration:500},hide:{effect:"blind",duration:500},title:"Change Log",resizable:!0,draggable:!0,height:600,width:600,dialogClass:"ui-dialog-osx",modal:!0,close:function(e,t){$(this).dialog("destroy")}})}),googleAnalytics.sendEvent("ChangeLog","Click")});var n="https://docs.google.com/spreadsheets/d/119bzkEulpTHt1YVup_N2ZaVoYyWlxJQJBVvhbdl_ymI/pub?gid=0&single=true&output=csv";$.ajax(n).done(function(e){function t(e){var t=new Date(e[1]),n=new Date;return n>t}function n(e){var t=e[0];return"TRUE"===t}function a(e){return e[2]}function o(e){return e[3]}function l(e){return e[4]}var r,s=CSVToArray(e),i=[],c=4,g=[];for(r=1;r<s.length;++r){var d=s[r];!t(d)&&n(d)&&i.length<c&&i.push(d),t(d)||n(d)||g.push(d)}for(;i.length<c&&g.length>0;){var h=g.length,r=math.randomInt(h),u=g.splice(r,1);i.push(u[0])}var f=$(".newsSection");for(f.empty(),r=0;r<i.length;++r){var d=i[r];switch(localStorage.getItem("lang")){case"en":var m=a(d);break;case"zh":var m=l(d);break;default:var m=a(d)}var p=o(d),v="<li>";p&&(v+='<a class="link" href="'+p+'" target="_blank" style = "text-decoration: underline;">'),v+=m,p&&(v+="</a>"),v+="</li>",f.append(v)}}).error(function(){$("#loading-news").hide();var e=getMessage("googleNA");$("#news-error").html('<span style="color:orange">'+e+"</span>")}),$(".tab-landing #credits").on("click",function(){$("#showDialog").load("./credits.html",function(){$("#showDialog").dialog({show:{effect:"blind",duration:500},hide:{effect:"blind",duration:500},title:"Credits",resizable:!0,draggable:!0,height:600,width:600,dialogClass:"ui-dialog-osx",modal:!0,close:function(e,t){$(this).dialog("destroy")}})}),googleAnalytics.sendEvent("Credits","Click")}),chrome.storage.local.get("lastVersion",function(e){if(void 0!==e.lastVersion&&e.lastVersion!==chrome.runtime.getManifest().version){var t=function(){$("#changeLog").effect("bounce","slow")},n=function(e){e>0&&(t(),setTimeout(function(){n(e-1)},2e3))};$("#changeLog").html('<span style="color:green">*New* </span>Change Log'),n(4)}var a={};a.lastVersion=chrome.runtime.getManifest().version,chrome.storage.local.set(a)});var a=$("#landing-right-button"),o=a.find(".submit-feedback");o.on("click",function(){var e,t="random_number",n=getMessage("submit"),a=$("#feedback").val(),l=$("#feedback-email").val();""!==a&&(o.html(getMessage("sending")),chrome.storage.local.get(t,function(r){function s(){$("#feedback").val(""),$("#feedback-email").val(""),o.html(n)}if($.isEmptyObject(r)){e=10*Math.random();var i={};i[t]=e,chrome.storage.local.set(i)}else e=r.random_number;var c="https://docs.google.com/forms/d/140lMvUhgniDF3l6Nal4Z9SnFmynRoPoNr0hqvOaVLPY/formResponse";$.ajax({type:"POST",url:c,data:{"entry.982187054":a+" "+l,entry_1797468059:e},success:function(e){console.log("Message sent to developpers");var t=getMessage("receivedthanks");o.html('<span style="color:green">'+t+"</span>"),$("#feedback-error").html(""),setTimeout(s,3e3)},error:function(e,t){console.log("Message not sent. There might be a problem with your internet connection");var n=getMessage("googleNA");$("#feedback-error").html('<span style="color:orange">'+n+"</span>"),s()}})}))}),$("#landing-left a, #landing-right a, .ui-dialog-osx a").click(function(){googleAnalytics.sendEvent("ExternalUrls","Click",$(this).prop("href"))}),e&&e()})},TABS.landing.cleanup=function(e){e&&e()};